<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function Request() {
      this.getUrl = function (params) {
        let root = 'www.cctv.com'
        let str = Object.keys(params).map((val)=>{
          return `${val}=${params[val]}`
        }).join('&')
        
        let artUrl = `${root}?${this.name}/${str}`
        return artUrl;
      }
    }
    // function Article() {
    //   this.name = 'appp',
    //   this.id = 1000
    //   this.getUrl = function(params){
    //     let root = 'www.cctv.com'
    //     let str = Object.keys(params).map((val)=>{
    //       return `${val}=${params[val]}`
    //     }).join('&')
    //     console.log(str);
        
    //     let artUrl = `${root}?${str}`
    //     return artUrl 
        
    //   }
    // }
    function Article() {
      this.name = 'appp',
      this.id = 1000
      Request.apply(this)
    }
    let a = new Article()
    console.log(a.getUrl({id: 300, art: 'huu'}));

  </script>
</body>

</html>